/*!
 * index main JS.
 * 
 * @since: 1.0.0 2017/4/12
 * @author Way Lau <https://waylau.com>
 */
"use strict";
var imgs = $("img");
var uploadImg = function (imgId) {
    $.ajax({
        url: 'http://localhost:8090/img/getImg',
        type: 'POST',
        cache: true,
        data:{id:imgId},
        dataType : "json",
        async:false,
        success: function(data){
            $("img[data-imgid='"+data.id+"']").attr("src",data.baseValue);
        },
        error : function() {
            toastr.error("error!");
        }
    })
};

for(var i=0;i<imgs.length;i++){
    if($(imgs[i]).data("imgid")){
        uploadImg($(imgs[i]).data("imgid"));
    }
}